package com.klei.service.impl;

import com.klei.dao.IUserDao;
import com.klei.pojo.User;
import com.klei.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserDao userDao;

    @Override
    public List<User> getAllUser() {
        return userDao.getAllUser();
    }

    @Override
    public List<User> getAllUserByPage(int page, int limit) {
        return userDao.getAllUserByPage(page, limit);
    }

    @Override
    public int getUserCount() {
        return userDao.getUserCount();
    }

    @Override
    public User getUserByTAndP(String tel, String password) {
        return userDao.getUserByTAndP(tel, password);
    }

    @Override
    public User getUserByTel(String tel) {
        return userDao.getUserByTel(tel);
    }

    @Override
    public User getUserByUid(int uid) {
        return userDao.getUserByUid(uid);
    }

    @Override
    public boolean saveUser(User user) {
        return userDao.saveUser(user) > 0;
    }

    @Override
    public boolean updateUser(User user) {
        return userDao.updateUser(user) > 0;
    }

    @Override
    public boolean updateUserPass(int uid, String pass) {
        return userDao.updateUserPass(uid, pass) > 0;
    }

    @Override
    public boolean deleteUser(int uid) {
        return userDao.deleteUser(uid) > 0;
    }
}
